package TCPTest01;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {
        //客户端：多次发送数据
        //服务器：接收多次接收数据，并打印

        //1、创建socket对象
        Socket socket = new Socket("127.0.0.1",10000);

        //2、发送数据
        OutputStream out = socket.getOutputStream();
        Scanner scanner = new Scanner(System.in);

        while (true) {
            String str = scanner.nextLine();
            if ("886".equals(str)){
                break;
            }
            out.write(str.getBytes());
        }

        //3、释放资源
        socket.close();
    }
}
